# coding: UTF-8
import logging; logging.basicConfig(level=logging.INFO)

import asyncio
import os
import json
import time
from datetime import datetime

from aiohttp import web


def index(request):
    return web.Response(body="<h1>Arc</h1>")   # 这里出现中文会报错


@asyncio.coroutine
def init(loop):
    INS_app = web.Application(loop=loop)
    INS_app.router.add_route("GET", "/", index)
    # IP_address = "127.0.0.1"
    IP_address = "172.21.0.6"
    port = 9000
    srv = yield from loop.create_server(INS_app.make_handler(), IP_address, port)
    logging.info("Server started at http://" + IP_address + ":" + str(port))
    return srv


loop = asyncio.get_event_loop()
loop.run_until_complete(init(loop))
loop.run_forever()
